{
  "properties" : { },
  "id" : "463ef35843f641d78e2f3a33cfbb7d58",
  "script" : null,
  "groupId" : "a429965ae8fe4532916947ca2b658750",
  "name" : "刷新监控画面",
  "createTime" : null,
  "updateTime" : 1730866918458,
  "lock" : null,
  "createBy" : null,
  "updateBy" : "管理员",
  "path" : "ychmtc",
  "method" : "GET",
  "parameters" : [ {
    "name" : "id",
    "value" : "10001",
    "description" : null,
    "required" : true,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : null,
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
import org.eclipse.paho.client.mqttv3.MqttMessage;
import com.alibaba.fastjson.JSONObject;
import 'sendMqttClient' as sendMqttClient;

    var taskId = id + "_2"

    var taskObj = db.table("mq_task").where().eq("id", taskId).and().eq("type", "img_start").selectOne();
    var msgPage = taskObj.pageTopic;
    var mqMsg = JSONObject.toJSONString(taskObj);

    MqttMessage msg = new MqttMessage();
    msg.setPayload(mqMsg.getBytes());

    db.table("mq_bk_msg").where().eq("msg_id", taskId).delete();

    sendMqttClient.getTopic(msgPage).publish(msg).waitForCompletion();

    var i = 20
    while(i > 0){
        Thread.sleep(800L);
        
        if(db.table("mq_bk_msg").where().eq("msg_id", taskId).and().eq('type', 'img').count() > 0){
          db.table("mq_bk_msg").where().eq("msg_id", taskId).and().eq('type', 'txt').delete();
            return 1;
        }
        i--;
    }

return 0;